Skip to content

Fix NaN handling in getFreebuffStreakLine - #1248

Open
pavankumar-vh wants to merge 1 commit into
CodebuffAI:mainfrom
pavankumar-vh:fix/streak-line-nan-handling
Open

Fix NaN handling in getFreebuffStreakLine#1248
pavankumar-vh wants to merge 1 commit into
CodebuffAI:mainfrom
pavankumar-vh:fix/streak-line-nan-handling

Conversation

@pavankumar-vh

Copy link
Copy Markdown

Overview

Fix NaN handling in the getFreebuffStreakLine function in common/src/util/freebuff-streak-line.ts.

Bug Description

The function didn't validate that streak is a finite number. If streak was NaN or Infinity, Math.min(NaN, 7) would return NaN, and chars.filled.repeat(NaN) would throw a RangeError.

Fix

Added Number.isFinite() check to default to 0 for invalid numbers.

Testing

No existing tests for this function, but the fix prevents runtime errors with invalid inputs.

Files Changed

  • common/src/util/freebuff-streak-line.ts - Added NaN validation

Scope

This change only touches common/ which is an approved contribution area per the Contributing Guide.

The function didn't validate that streak is a finite number. If streak was
NaN or Infinity, Math.min(NaN, 7) would return NaN, and chars.filled.repeat(NaN)
would throw a RangeError.

Added Number.isFinite() check to default to 0 for invalid numbers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant